package com.providerService.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.providerService.service.TestService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private TestService testService;

    /**
     * consumerService项目中使用了Sentinel对feigin的支持的话，则不需要使用此注解
     * SentinelResource注解
     * value 指定资源名称
     * blockHandler 限流之后执行的方法，blockHandlerClass限流之后执行的类
     * fallback 熔断之后执行的方法，fallbackClass熔断之后执行的类
     * 方法或类型需要自己去实现
     */
    @GetMapping("/getMapInfo/{id}")
//    @SentinelResource(value="getMapInfo",blockHandler = "",fallback = "")
    public Map<String,Object> getMapInfo(@PathVariable("id") Integer id) {
        return testService.mapInfo();
    }


    @GetMapping("/postMapInfo")
    public Map<String,Object> postMapInfo() {
        return testService.mapInfo();
    }
    
}
